<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of home_references
 *
 * @author Gidaff_01
 */
class home_references extends FrontEnd_Controller{
    //put your code here
    function __construct() {
        parent::__construct();
        $this->load->model('Home_references_m');
        $this->_data['erreur'] = "";
    }

    function list_references(){
        $per_page = $this->uri->segment(3);
        if ($per_page == "") {
            $per_page = 10;
        }
        $off_set = $this->uri->segment(4);
        if ($off_set == "") {
            $off_set = 0;
        }
        $config['base_url'] = base_url() . 'index.php/home_references/list_references/' . '/' . $per_page . '/';
        $config['per_page'] = '10';
        $config['uri_segment'] = 4;
        $config['total_rows'] = $this->db->count_all('our_references');
        if ($off_set > 0 && $off_set == $config['total_rows']) {
            $off_set = $off_set - $per_page;
        }
        $this->_data['list_references'] = $this->Home_references_m->get_all_references($config['per_page'], $off_set);
        $this->pagination->initialize($config);
        $this->_data['pagination'] = $this->pagination->create_links();
        $this->_data['total'] = $this->db->count_all('our_references');
        $this->_data['page_title'] = "Liste de references";
        $this->_data['per_page'] = $per_page;
        $this->_data['off_set'] = $off_set;
        $this->display_view('home/list_references');
    }

    function detail_references($id){
        $query = $this->_data['detail_references'] = $this->Home_references_m->get_references_by_id($id);
        $this->display_view('home/detail_references');
    }

}
?>
